package com.topvision.gsj.launcher.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;

public class AppFragmentAdapter extends FragmentStatePagerAdapter {
	private List<Fragment> mFragments;

	public AppFragmentAdapter(FragmentManager fm) {
		super(fm);
	}

	public AppFragmentAdapter(FragmentManager fm, List<Fragment> fragments) {
		super(fm);
		mFragments = fragments;
	}

	@Override
	public Fragment getItem(int arg0) {
		// TODO Auto-generated method stub
		return mFragments.get(arg0);
	}

	@Override
	public int getCount() {
		return mFragments.size();
	}

	@Override
	public int getItemPosition(Object object) {
		return PagerAdapter.POSITION_NONE;
	}

	/**
	 * 更新视图
	 * 
	 * @param mFragments
	 */
	public void updateData(List<Fragment> mFragments) {
		this.mFragments = mFragments;
		notifyDataSetChanged();
	}

}
